<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qsurface.cpp -->
  <title>QSurface Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QSurface</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QSurface Class</h1>
<!-- $$$QSurface-brief -->
<p>The QSurface class is an abstraction of renderable surfaces in Qt. <a href="#details">More...</a></p>
<!-- @@@QSurface -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QSurface&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.0</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qoffscreensurface.html">QOffscreenSurface</a> and <a href="qwindow.html">QWindow</a></p>
</td></tr></table></div><p>This class was introduced in Qt 5.0.</p>
<ul>
<li><a href="qsurface-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#SurfaceClass-enum">SurfaceClass</a></b> { Window, Offscreen }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#SurfaceType-enum">SurfaceType</a></b> { RasterSurface, OpenGLSurface, RasterGLSurface, OpenVGSurface, VulkanSurface, MetalSurface }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#dtor.QSurface">~QSurface</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSurfaceFormat </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#format">format</a></b>() const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#size">size</a></b>() const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#supportsOpenGL">supportsOpenGL</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSurface::SurfaceClass </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#surfaceClass">surfaceClass</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPlatformSurface *</td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#surfaceHandle">surfaceHandle</a></b>() const = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSurface::SurfaceType </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#surfaceType">surfaceType</a></b>() const = 0</td></tr>
</table></div>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsurface.html#QSurface">QSurface</a></b>(QSurface::SurfaceClass <i>type</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QSurface-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The size of the surface is accessible with the <a href="qsurface.html#size">size</a>() function. The rendering specific attributes of the surface are accessible through the <a href="qsurface.html#format">format</a>() function.</p>
</div>
<!-- @@@QSurface -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$SurfaceClass$$$Window$$$Offscreen -->
<h3 class="fn" id="SurfaceClass-enum"><a name="SurfaceClass-enum"></a>enum QSurface::<span class="name">SurfaceClass</span></h3>
<p>The SurfaceClass enum describes the actual subclass of the surface.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSurface::Window</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The surface is an instance of <a href="qwindow.html">QWindow</a>.</td></tr>
<tr><td class="topAlign"><code>QSurface::Offscreen</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The surface is an instance of <a href="qoffscreensurface.html">QOffscreenSurface</a>.</td></tr>
</table></div>
<!-- @@@SurfaceClass -->
<!-- $$$SurfaceType$$$RasterSurface$$$OpenGLSurface$$$RasterGLSurface$$$OpenVGSurface$$$VulkanSurface$$$MetalSurface -->
<h3 class="fn" id="SurfaceType-enum"><a name="SurfaceType-enum"></a>enum QSurface::<span class="name">SurfaceType</span></h3>
<p>The SurfaceType enum describes what type of surface this is.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSurface::RasterSurface</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The surface is is composed of pixels and can be rendered to using a software rasterizer like Qt's raster paint engine.</td></tr>
<tr><td class="topAlign"><code>QSurface::OpenGLSurface</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The surface is an OpenGL compatible surface and can be used in conjunction with <a href="qopenglcontext.html">QOpenGLContext</a>.</td></tr>
<tr><td class="topAlign"><code>QSurface::RasterGLSurface</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The surface can be rendered to using a software rasterizer, and also supports OpenGL. This surface type is intended for internal Qt use, and requires the use of private API.</td></tr>
<tr><td class="topAlign"><code>QSurface::OpenVGSurface</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The surface is an <a href="../qtquick/qtquick-visualcanvas-adaptations.html#openvg">OpenVG</a> compatible surface and can be used in conjunction with <a href="../qtquick/qtquick-visualcanvas-adaptations.html#openvg">OpenVG</a> contexts.</td></tr>
<tr><td class="topAlign"><code>QSurface::VulkanSurface</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">The surface is a Vulkan compatible surface and can be used in conjunction with the Vulkan graphics API.</td></tr>
<tr><td class="topAlign"><code>QSurface::MetalSurface</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">The surface is a Metal compatible surface and can be used in conjunction with Apple's Metal graphics API. This surface type is supported on macOS only.</td></tr>
</table></div>
<!-- @@@SurfaceType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSurface[overload1]$$$QSurfaceQSurface::SurfaceClass -->
<h3 class="fn" id="QSurface"><a name="QSurface"></a><code>[protected] </code>QSurface::<span class="name">QSurface</span>(<span class="type"><a href="qsurface.html#SurfaceClass-enum">QSurface::SurfaceClass</a></span> <i>type</i>)</h3>
<p>Creates a surface with the given <i>type</i>.</p>
<!-- @@@QSurface -->
<!-- $$$~QSurface[overload1]$$$~QSurface -->
<h3 class="fn" id="dtor.QSurface"><a name="dtor.QSurface"></a><code>[virtual] </code>QSurface::<span class="name">~QSurface</span>()</h3>
<p>Destroys the surface.</p>
<!-- @@@~QSurface -->
<!-- $$$format[overload1]$$$format -->
<h3 class="fn" id="format"><a name="format"></a><code>[pure virtual] </code><span class="type"><a href="qsurfaceformat.html">QSurfaceFormat</a></span> QSurface::<span class="name">format</span>() const</h3>
<p>Returns the format of the surface.</p>
<!-- @@@format -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn" id="size"><a name="size"></a><code>[pure virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QSurface::<span class="name">size</span>() const</h3>
<p>Returns the size of the surface in pixels.</p>
<!-- @@@size -->
<!-- $$$supportsOpenGL[overload1]$$$supportsOpenGL -->
<h3 class="fn" id="supportsOpenGL"><a name="supportsOpenGL"></a><span class="type">bool</span> QSurface::<span class="name">supportsOpenGL</span>() const</h3>
<p>Returns true if the surface is OpenGL compatible and can be used in conjunction with <a href="qopenglcontext.html">QOpenGLContext</a>; otherwise returns false.</p>
<p>This function was introduced in Qt 5.3.</p>
<!-- @@@supportsOpenGL -->
<!-- $$$surfaceClass[overload1]$$$surfaceClass -->
<h3 class="fn" id="surfaceClass"><a name="surfaceClass"></a><span class="type"><a href="qsurface.html#SurfaceClass-enum">QSurface::SurfaceClass</a></span> QSurface::<span class="name">surfaceClass</span>() const</h3>
<p>Returns the surface class of this surface.</p>
<!-- @@@surfaceClass -->
<!-- $$$surfaceHandle[overload1]$$$surfaceHandle -->
<h3 class="fn" id="surfaceHandle"><a name="surfaceHandle"></a><code>[pure virtual] </code><span class="type">QPlatformSurface</span> *QSurface::<span class="name">surfaceHandle</span>() const</h3>
<p>Returns a handle to the platform-specific implementation of the surface.</p>
<!-- @@@surfaceHandle -->
<!-- $$$surfaceType[overload1]$$$surfaceType -->
<h3 class="fn" id="surfaceType"><a name="surfaceType"></a><code>[pure virtual] </code><span class="type"><a href="qsurface.html#SurfaceType-enum">QSurface::SurfaceType</a></span> QSurface::<span class="name">surfaceType</span>() const</h3>
<p>Returns the type of the surface.</p>
<!-- @@@surfaceType -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
